package nr.co.mhgames.polyanim.renderer.modifiers;

/**
 * Alpha modifier simply multiplies the alpha of the animation polygons with the
 * given alpha factor (between 0.0 - 1.0). This can be used to fade the
 * animation. Note, however, that the modifier is applied to every single
 * polygon, not to the whole thing as whole, so the end result might not be what
 * is expected for more complex animations (i.e. when the animation has
 * overlapping polygon groups).
 * 
 * @author Mika Halttunen
 */
public class AlphaModifier implements RenderModifier {
	/**
	 * Alpha factor (zero yields zero alpha, one yields the original alpha
	 * value)
	 */
	public float factor;

	/**
	 * Constructor.
	 * 
	 * @param factor
	 *            Alpha factor (0.0f - 1.0f)
	 */
	public AlphaModifier(float factor) {
		if (factor < 0)
			factor = 0;
		if (factor > 1.0f)
			factor = 1.0f;
		this.factor = factor;
	}
}
